<template>
    <rx-layout>
        <div slot="center">
            <div class="miniQuery_userConfig">
                <div style="line-height: 30px;height: 30px">{{i18n('tips.code','此处代码是java代码')}}</div>
                <rx-monaco-editor  ref="javaCode"
                                   class="miniQuery_userConfig-monaco"
                                   v-model="localScript"
                                   language="javascript">
                <span slot="monacoeditor">
                    <mini-query-script-vars @insertScript="insertJavaCode" />
                </span>
                </rx-monaco-editor>
            </div>
        </div>
    </rx-layout>

</template>

<script>
    import {RxLayout,RxMonacoEditor} from "@lowcode/jpaas-common-lib"
    import miniQueryScriptVars from "./miniQueryScriptVars";
    export default {
        name: "miniQuery_userConfig",
        props: ["layerid", "destroy"],
        components:{
            RxLayout,
            RxMonacoEditor,
            miniQueryScriptVars
        },
        data() {
            return {
                localScript:""
            }
        },
        created() {

        },
        methods: {
            i18n(name, text, key) {
                return this.$ti18(name, text, "miniQuery", key);
            },
            validate(callback) {
                callback();
            },
            setData(row){
                this.localScript=row.setting;
            },
            getData(){
                return {setting:this.localScript};
            },
            insertJavaCode(text){
                this.$refs.javaCode.insertContent(text);
            }
        }
    }
</script>

<style scoped>
.miniQuery_userConfig{
    display: flex;
    height: calc(100% - 20px);
    flex-direction: column;
    padding: 0px 10px;
}
.miniQuery_userConfig-monaco{
    flex: 1;
}
</style>